package com.lqs.blog.controller;

import com.lqs.blog.pojo.Permission;
import com.lqs.blog.service.PermissionService;

import com.lqs.blog.vo.PageResult;
import com.lqs.blog.vo.Result;
import com.lqs.blog.vo.params.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin")
public class AdminController {
    @Autowired
    private PermissionService permissionService;

    @PostMapping("permission/permissionList")
    public Result permission(@RequestBody PageParam pageParam) {

        return permissionService.permission(pageParam);
    }

    @PostMapping("permission/add")
    public Result add(@RequestBody Permission permission) {

        return permissionService.add(permission);
    }

    @PostMapping("permission/update")
    public Result update(@RequestBody Permission permission) {//接收json数据类型

        return permissionService.update(permission);
    }

    @GetMapping("permission/delete/{id}")
    public Result delete(@PathVariable("id") Long id) {

        return permissionService.delete(id);
    }
}
